package com.lxq.sign.controller;

import com.lxq.sign.domain.StudentInf;
import com.lxq.sign.service.LogInfoService;
import com.lxq.sign.service.StuLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@SuppressWarnings({"all"})
@RestController
@RequestMapping("/stuLogin")
public class StuLoginController {

    @Autowired
    StuLoginService stuLoginService;

    @Autowired
    LogInfoService logInfoService;

    public static List<String> stuNames = new ArrayList<>();


    @PostMapping("/{browser}")
    public Result stuLogin(@PathVariable String browser,@RequestBody StudentInf studentInf){

        Result result = stuLoginService.FindStu(studentInf, browser);
        logInfoService.saveInfoByStuCode(studentInf.getStuCode());
        return result;

    }

    @GetMapping("/{stuName}")
    public void repeatLogin(@PathVariable String stuName) {

        stuNames.add(stuName);

    }


}
